import request from '@/utils/request'
import { getToken } from '@/utils/auth'
var token = getToken();
export function getList (startTime, endTime, name, page, pageSize, status, type) {
  return request({
    url: '/pc/management/ad/getlist',
    method: 'post',
    data: {
      token: token,
      draw: 1,
      startTime: startTime,
      endTime: endTime,
      page: page,
      pageSize: pageSize,
      name: name,
      type: type,
      status: status,
    }
  })
}
export function getDetail (id) {
  return request({
    url: '/pc/management/ad/detail',
    method: 'post',
    data: {
      token: token,
      id: id
    }
  })
}
export function getDetailList (id) {
  return request({
    url: '/pc/management/order/detailOrderlist',
    method: 'post',
    data: {
      token: token,
      id: id
    }
  })
}
export function getExport (startTime, endTime, userIdCard, projectId, salesOrderId, userName, userPhone) {
  return request({
    url: '/pc/management/order/export',
    method: 'post',
    data: {
      token: token,
      startTime: startTime,
      endTime: endTime,
      userIdCard: userIdCard,
      projectId: projectId,
      salesOrderId: salesOrderId,
      userName: userName,
      userPhone: userPhone
    }
  })
}
export function setUp (id) {
  return request({
    url: "/pc/management/ad/takeOn",
    data: {
      token: token,
      id: id
    },
    method: 'post',
  })
}
export function setDown (id) {
  return request({
    url: "/pc/management/ad/takeOff",
    data: {
      token: token,
      id: id
    },
    method: 'post',
  })
}
export function upload (file) {
  return request({
    url: "/pc/management/ad/filesUpload_sj",
    data: {
      file: file
    },
    method: 'post',
  })
}
export function addAd (img, name, status, type, startTime, endTime,projectIds) {
  return request({
    url: "/pc/management/ad/add",
    method: 'post',
    data: {
      token: token,
      img: img, name: name,
      status: status,
      type: type,
      startTime: startTime,
      endTime: endTime,
      projectIds:projectIds
    }
  })
}
export function editAd (id,img, name, status, type, startTime, endTime,projectIds) {
  return request({
    url: "/pc/management/ad/update",
    method: 'post',
    data: {
      id:id,
      token: token,
      img: img, name: name,
      status: status,
      type: type,
      startTime: startTime,
      endTime: endTime,
      projectIds:projectIds
    }
  })
}
export function addAllProject () {
  return request({
    url: "/pc/management/ad/addAllProject",
    data: {
      token: token,
    },
    method: 'post',
  })
}
export function getAll () {
  return request({
    url: "/pc/management/ad/updateAllProject",
    data: {
      token: token,
    },
    method: 'post',
  })
}
